package com.swinw.asumall.order.config;

import com.swinw.asumall.order.interceptor.UserLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyUserLoginConfig implements WebMvcConfigurer {

    /**
     * 注册拦截器，拦截当前服务下的所有资源
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserLoginInterceptor())
        .addPathPatterns("/**");
    }
}
